package com.example.basicquestions.questions.二分查找II_二维数组遍历;
public class Solution {
    public boolean Find(int target, int [][] array) {
        int n = array.length;
        if(n == 0) {
            return false;
        }
        int m = array[0].length;
        if(m == 0) {
            return false;
        }
        
        for(int i = n -1,j = 0; i>=0 && j <m;){
            if(array[i][j] > target){
                i--; 
            }else if(array[i][j] < target){
                j++;
            }else{
                return true;
            }
        }

        return false;

    }
}
